# Maintainer (AUR): Sebastian Bøe <sebastianbooe@gmail.com>
# parabola changes and rationale:
# - Added armv7h and i686 architectures support
# Maintainer: Sagar Acharya <sagar@hyperbola.info>

pkgname=icestorm-git
pkgver=r20210309
_commit=c495861c19bd0976c88d4964f912abe76f3901c3
pkgrel=1
pkgdesc="Lattice iCE40 FPGAs Bitstream Documentation (Reverse Engineered)"
arch=('armv7h' 'i686' 'x86_64')
url="http://www.clifford.at/icestorm/"
license=('ISC')
depends=('python' 'libftdi')
makedepends=('git')
provides=("${pkgname%-git}")
conflicts=("${pkgname%-git}")
source=("https://github.com/YosysHQ/icestorm/archive/${_commit}.tar.gz")
sha512sums=('17cfce499173dffa0ae7d4564b89c0e28ef32a80534c07bf099958981e487db1ec6c35c6b82376e5513f9fe79f67a3e7dd360203512cd43686e52d47ae7f073a')
_prefix="/usr"

build() {
    cd "$srcdir/${pkgname%-git}-${_commit}"
    # Icestorm defaults to clang.
    CXX=gcc

    make CXX=$CXX PREFIX=$_prefix
}

package() {
    cd "$srcdir/${pkgname%-git}-${_commit}"

    install -Dm644 COPYING -t $pkgdir/usr/share/licenses/$pkgname
    install -m  644 README "$pkgdir/usr/share/licenses/$pkgname"

    # Install the package
    make DESTDIR="$pkgdir" PREFIX=$_prefix install
}
